package com.spark.incoicings.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.spark.incoicings.dao.ProductMapper;
import com.spark.incoicings.service.ProductService;
import com.spark.incoicings.vo.DictVO;
import com.spark.incoicings.vo.ProductVO;
import com.spark.invoicings.entity.Product;
import com.spark.invoicings.utils.Result;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product>implements ProductService {
    @Resource
    private ProductMapper productMapper;

    /**
     * 统计所有产品销售排行
     * @return
     */
    @Override
    public List<ProductVO> selectProductCount() {
        List<ProductVO> products = productMapper.selectProductCount();
        return products;
    }

    @Override
    public DictVO selectProductUnIt(Integer id) {
        DictVO dictVO = productMapper.selectProductUnIt(id);
        return dictVO;
    }
}
